<template>
  <el-popconfirm
    :title="title"
    :confirm-button-text="confirmButtonText"
    :cancel-button-text="cancelButtonText"
    :icon="icon"
    :icon-color="iconColor"
    @confirm="$emit('confirm')"
    @cancel="$emit('cancel')"
  >
    <template #reference>
      <slot></slot>
    </template>
  </el-popconfirm>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'

const props = defineProps({
  title: {
    type: String,
    default: '确认此操作?'
  },
  confirmButtonText: {
    type: String,
    default: '确定'
  },
  cancelButtonText: {
    type: String,
    default: '取消'
  },
  icon: {
    type: String,
    default: 'Warning'
  },
  iconColor: {
    type: String,
    default: '#f90'
  }
})

defineEmits(['confirm', 'cancel'])
</script>

<style scoped>
/* 可以在这里添加自定义样式 */
</style> 